define(["app"], function(app) {
	var deps = ["$http", "BaseService"];
	
	function resource($http, BaseService) {
		return initUploadResource($http,BaseService.restfulUrl + "import/",BaseService.formHeader);
	}
	
	function initUploadResource($http,uploadUrl,headers){
		return {
			uploadFile:function(formData,name,methodName){
				return $http.post(uploadUrl +methodName,formData,  {
					transformRequest: angular.identity,
					headers: {
                        "Content-Type": undefined
                    },
                    transformResponse: function (data) {
                        return {
                            fileId: data
                        };
                    }
				});
			},
			
			getCodes : function(type){	
				return $http.get(uploadUrl+'getCodes',{
					params: {
						type: type
                    }
				});
			}
			
		};
	}
	resource.$inject = deps;
	app.lazy.factory("UploadResources", resource);
});
